package myself.login.daoImpl;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import myself.entity.StudentInfoEntity;
import myself.login.dao.LoginDao;

@Repository
public class LoginDaoImpl implements LoginDao{

	@Resource
	private JdbcTemplate JdbcTemplate;
	
	public int qrystudentCode(String studentCode) {
		String sql = "select count(1) from ksxt_student_info where student_code = ?";
		return this.JdbcTemplate.queryForInt(sql,studentCode);
	}

	public String qryPassWord(String studentCode) {
		String sql = "select student_password from ksxt_student_info where student_code = ?";
		
		Map map = this.JdbcTemplate.queryForMap(sql,studentCode);
		return (String) map.get("student_passWord"); 
	}

	public String qryStudentName(String studentCode) {
         String sql = "select student_name from ksxt_student_info where student_code = ?";
		
		 Map map = this.JdbcTemplate.queryForMap(sql,studentCode);
		 return (String) map.get("student_name"); 
	}

	public int qryteacherCode(String teacherCode) {
		String sql = "select count(1) from ksxt_teacher_info where teacher_code = ?";
		return this.JdbcTemplate.queryForInt(sql,teacherCode);
	}

	public String qrytPassWord(String teacherCode) {
        String sql = "select teacher_password from ksxt_teacher_info where teacher_code = ?";
		
		Map map = this.JdbcTemplate.queryForMap(sql,teacherCode);
		return (String) map.get("teacher_passWord"); 
	}

	public String qryTeacherName(String teacherCode) {
		String sql = "select teacher_name from ksxt_teacher_info where teacher_code = ?";
		
		Map map = this.JdbcTemplate.queryForMap(sql,teacherCode);
		return (String) map.get("teacher_name");
	}

}
